#include "mainwindow.h"
#include <QApplication>

#include "wiringPi.h"
#include <QDebug>
#include <QTranslator>
#include "connectmysql.h"
#include "execsql.h"
#include "devices.h"

int main(int argc, char *argv[])
{
    QApplication app(argc, argv);

    if(wiringPiSetup() == -1)
    {
        qDebug() << "setup wiringPi failed !";
    }else
    {
        qDebug() << "setup wiringPi successed !";
        DEV_Init();
    }

    ConnectMySQL sql;
    if(sql.createConnection())
    {
        ExecSQL::searchAllUserInfos();
        qDebug() << "Success: connect DB!!";
    }

    QTranslator translator;
    translator.load(":/ch2en.qm");
    app.installTranslator(&translator);


    MainWindow m;
    m.show();

    return app.exec();
}
